//
//  WifiConfig.swift
//  aquariumstudio
//
//  Created by zj on 2022/11/3.
//  Copyright © 2022 LXF. All rights reserved.
//

import Foundation

import SystemConfiguration.CaptiveNetwork

public class WifiConfig {
    //获取 WiFi 信息
    public static func getWifiInfo() -> (ssid: String, mac: String) {
        if let cfas: NSArray = CNCopySupportedInterfaces() {
            for cfa in cfas {
                if let dict = CFBridgingRetain(
                    CNCopyCurrentNetworkInfo(cfa as! CFString)
                ) {
                    if let ssid = dict["SSID"] as? String,
                       let bssid = dict["BSSID"] as? String {
                        return (ssid, bssid)
                    }
                }
            }
        }
        return ("unknown", "unknown")
    }

}
